package org.itstack.demo.design;

/**
 * 懒汉模式 线程安全
 * 所有的访问都因需要锁占用导致资源的浪费。不建议用
 */
public class Singleton_02 {

    private static Singleton_02 instance;

    private Singleton_02() {

    }

    public static synchronized Singleton_02 getInstance() {
        if (null != instance) {
            return instance;
        }
        return new Singleton_02();
    }


}
